import React from 'react'
import { useDispatch,useSelector } from 'react-redux';
import { addsplice } from '../store/modules/Splice'; 


const Myhome: React.FC = () => {
    const dispath = useDispatch()

    const splice = useSelector((state:any)=>state.Splice.splice);

    const handleAddSplice = () =>{
        dispath(addsplice([...splice,'hello world']))
    }

    return (
        <div>
            <h1>Myhome</h1>
            <button onClick={handleAddSplice}>添加</button>
            <ul>
                {splice.map((item:any,index:number)=>(
                    <li key={index}>{item}</li>
                ))}
            </ul>
        </div>
    )
}

export default Myhome;
